package com.ymatou.iapi.csim.testcase;

import java.util.List;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.ymatou.iapi.csim.parameter.FetchAllDiscourseCategoryResp;
import com.ymatou.iapi.csim.parameter.FetchAllDiscourseCategoryResp.FetchAllDiscourseCategory;
import com.ymatou.iapi.csim.parameter.SaveOrUpdateDiscourseBean;
import com.ymatou.iapi.csim.parameter.GetCurrentSessionListResp.SessionDto;
import com.ymatou.iapi.csim.service.FetchAllDiscourseCategoryCall;
import com.ymatou.iapi.csim.service.SaveOrUpdateDiscourseCall;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.*;
import com.ymt.utils.tag.*;
import com.ymttest.business.service.CsimCallService;
import com.ymttest.database.model.ymt_discoursecategory;
import com.ymttest.database.model.ymt_individualdiscourse;
import com.ymttest.database.sqlwapper.CSIM.ymt_discourseWapper;
import com.ymttest.database.sqlwapper.CSIM.ymt_discoursecategoryWapper;
import com.ymttest.utils.EnvSetup;
import com.ymttest.utils.TestDataManager;
/**
*获取所有有效的话术分类
*FreeMaker Template自动生成代码
*/
@TestSuite
public class Ts_FetchAllDiscourseCategory{
	private static FetchAllDiscourseCategoryCall call;
	private ymt_discoursecategoryWapper discoursecategoryWapper=new ymt_discoursecategoryWapper();
	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("获取所有有效的话术分类");
	}

	@Before
	public void caseUp() {
		call=new FetchAllDiscourseCategoryCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(call.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_FetchAllDiscourseCategory_1() {
		Logger.start(true,"获取所有有效的话术分类");
		try {
			call.callService();			
			//验证ymt_discoursecategory表第"+(i+1)+"条
			Logger.verifyEquals("200", call.getStatus().toString(), "验证Status");
			Logger.verifyEquals("", call.getMsg(), "验证Msg");
			
			List<FetchAllDiscourseCategory> callList=call.getData().getResult();
			List<ymt_discoursecategory>  list=discoursecategoryWapper.selectAll();
			for(int i=0;i<list.size();i++)
			{
				Logger.verifyEquals(callList.get(i).getCategoryId(), list.get(i).getCategoryId(), "验证ymt_discoursecategory表第"+(i+1)+"条ymt_discoursecategory表第"+(i+1)+"条字段CategoryId");
				Logger.verifyEquals(callList.get(i).getTitle(), list.get(i).getTitle(), "验证ymt_discoursecategory表第"+(i+1)+"条Title");
				Logger.verifyEquals(callList.get(i).getRoleType(), list.get(i).getRoleType(), "验证ymt_discoursecategory表第"+(i+1)+"条RoleType");
				Logger.verifyEquals(callList.get(i).getCsId(), list.get(i).getCsId(), "验证ymt_discoursecategory表第"+(i+1)+"条CsId");
				Logger.verifyEquals(callList.get(i).getSort(), list.get(i).getSort(), "验证ymt_discoursecategory表第"+(i+1)+"条Sort");
			}
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
}
